package api.webview;

import android.content.Context;

import java.lang.ref.SoftReference;

/**
 * Created by cyly on 16/8/11.
 */
public abstract class API_WebView {
    public abstract void startWebViewActivity(Context ct,String url,String adCode);

    public abstract void startWebViewActivity(Context ct,String url);

    public abstract void startWebViewActivityTwo(Context ct,String url);

    public abstract void initX5Core(Context cxt);

    public static String clazz = "api.global.WebViewAPI";

    private static SoftReference<API_WebView> sf;

    public synchronized static API_WebView getInstance() {
        if (sf == null || sf.get() == null) {
            Object o = null;
            try {
                o = Class.forName(clazz).newInstance();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
            if (o != null) {
                sf = new SoftReference<API_WebView>((API_WebView)o);
                return (API_WebView)o;
            }
        }
        return sf == null ? null : sf.get();
    }
}


